Overview
The timer is a basic component. Whether it is user space program development or kernel space program development, a timer is often needed as the basic component, the implementation of the timer is also different. This article discusses
The purpose of using a timer is to perform a task periodically, or to perform a task at a specified time. In order to achieve this goal, there are generally two common and more effective methods. One is using the three timer inside Linux, and the
10.5.2 proficient in timer settings
The timer set by the function alarm can only be accurate to seconds, while the following functions can theoretically be accurate to the subtle:
#include #include int getitimer(int which, struct
The timer set by the function alarm can only be accurate to seconds, while the following functions can theoretically be accurate to the subtle:
# Include
# Include
Int getitimer (INT which, struct itimerval * value );
Int setitimer (INT which,
Author: gaopenghigh (gaopenghigh@gmail.com), reprinted please indicate the source.
The kernel needs to do two things about time:
Save the current time and date.
Maintain the timer.
Real-time clock of hardware and circuit (RTC)
Real-Time Clock
1. Time Representation
In the program, we often need to output the current time of the system, for example, the output result using the date command. At this time, we can use the following two functions:
# Include
Time_t time (time_t * tloc );
Char *
The current development tools of the software industry, from C to C + +, from Java to. NET, new architecture, new components, the knowledge that today just learned, perhaps tomorrow is outdated. In order to gain a foothold in the fierce
Use of timers in Linux -- alarm () & setitimer ():
1. Alarm-------------------------------------------Alarm () and signal () are enough if they are not required to be accurate.Unsigned int alarm (unsigned int seconds)Function Description: Alarm ()
Purgatory Time-out detectionWhen a delayedopeartion time-out (timeout), it needs to be detected and then call its callback method. It seems simple, but it's not easy to do it well.The implementation of the 0.8.x Kafka is straightforward, but
Implementation plan framework
In the previous section, we learned how to use the scheduler framework and compared it with the Java timer framework. Next, I will show you how to implement this framework. In addition to the scheduleiterator interface
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.